package com.netease.nim.demo.main.model;

import com.netease.nim.demo.main.fragment.ContactsFragmentWithoutTitle;
import com.netease.nim.demo.main.fragment.MainTabFragment;
import com.netease.nim.demo.main.fragment.RecentContactsFragment;
import com.netease.nim.demo.main.reminder.ReminderId;
import com.shwread.android.qysw10000136.R;

public enum MainTab {
	CONTACT(0, ReminderId.CONTACT, ContactsFragmentWithoutTitle.class, R.string.main_tab_contact, R.layout.new_i_contacts_frament),
	RECENT_CONTACTS(1, ReminderId.SESSION, RecentContactsFragment.class, R.string.main_tab_session, R.layout.messages),
	;

	public final int tabIndex;

	public final int reminderId;

	public final Class<? extends MainTabFragment> clazz;

	public final int resId;

	public final int fragmentId;

    public final int layoutId;

	private MainTab(int index, int reminderId, Class<? extends MainTabFragment> clazz, int resId, int layoutId) {
		this.tabIndex = index;
		this.reminderId = reminderId;
		this.clazz = clazz;
		this.resId = resId;
		this.fragmentId = index;
        this.layoutId = layoutId;
	}

	public static final MainTab fromReminderId(int reminderId) {
		for (MainTab value : MainTab.values()) {
			if (value.reminderId == reminderId) {
				return value;
			}
		}

		return null;
	}

	public static final MainTab fromTabIndex(int tabIndex) {
		for (MainTab value : MainTab.values()) {
			if (value.tabIndex == tabIndex) {
				return value;
			}
		}

		return null;
	}
}
